package com.hcbd.tdwt.ui.xingyu.fragment;

import android.annotation.SuppressLint;

import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.RadioButton;


import com.hcbd.tdwt.R;
import com.hcbd.tdwt.base.BaseFragment;
import com.hcbd.tdwt.base.bd.BdToolFactory;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.CheckedChange;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EFragment;
import org.androidannotations.annotations.ViewById;


@SuppressLint("NonConstantResourceId")
@EFragment(R.layout.activity_app_sos_msg)
public class SendSOSFragment extends BaseFragment{
    @ViewById
    ImageButton headLeft;

    @ViewById
    LinearLayout labelLL,resultLL;
    @ViewById
    RadioButton appSos, deviceSos;
    AppSendSOSFragment_ appSendSOSFragment;
    BdDeviceSendSosFragment_ bdDeviceSendSosFragment;
    @AfterViews
    protected void init() {
        appSendSOSFragment=new AppSendSOSFragment_();
        bdDeviceSendSosFragment=new BdDeviceSendSosFragment_();
        if(BdToolFactory.MOBILE_PHONE_TYPE==BdToolFactory.SATELLITE_MOBILE_PHONE){
            deviceSos.setVisibility(View.GONE);
            appSos.setBackground(null);
            appSos.setTextSize(18);
            appSos.setChecked(true);
        }else{
            appSos.setVisibility(View.GONE);
            deviceSos.setBackground(null);
            deviceSos.setTextSize(18);
            deviceSos.setChecked(true);
        }

        bdDeviceSendSosFragment.onSwitch();
    }


    @CheckedChange
    void appSos(boolean isChecked){
        if(isChecked) {
            switchFragment(appSendSOSFragment, R.id.resultLL);
        }
    }

    @CheckedChange
    void deviceSos(boolean isChecked){
        if(isChecked) {
            switchFragment(bdDeviceSendSosFragment, R.id.resultLL);
        }
    }
    @Click
    void headLeft(){

    }


    @Override
    public void onSwitch(){
        if(appSendSOSFragment!=null) {
            appSendSOSFragment.onSwitch();
        }
    }
    @Override
    public void  onHiddenChanged(boolean hidden) {
        Log.e("onHiddenChanged_send:",hidden+"");
        super.onHiddenChanged(hidden);
        if(hidden){
            //不可见
            hideInputKeyBord();
        }
    }
}
